package com.qczl.pme.service.impl;

import org.jboss.logging.Logger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.qczl.pme.dao.StbDao;
import com.qczl.pme.entity.PMESTB;
import com.qczl.pme.service.StbService;
import com.qczl.pme.vo.StbVo;

/**
 * 机顶盒业务逻辑层实现类
 * 
 * @author SongR
 *
 */
@Service
public class StbServiceImpl implements StbService {
	Logger log = Logger.getLogger(this.getClass());

	@Autowired
	StbDao stbdao;

	/**
	 * 实现根据机顶盒mac获取机顶盒信息
	 */
	@Override
	public StbVo getByStbNo(String stbno) throws Exception {
		PMESTB stb = stbdao.get("from PMESTB where no ='" + stbno + "' and status=0");
		if (null != stb) {
			StbVo vo = new StbVo();
			BeanUtils.copyProperties(stb, vo);
			vo.setAreaid(stb.getArea().getId());
			vo.setAreaname(stb.getArea().getName());
			return vo;
		}
		return null;
	}

}
